Skip to content

fix: transition --stamp only for the build data dependency - #4484

Open
cjm-dd wants to merge 1 commit into
bazel-contrib:mainfrom
cjm-dd:stamp-transition-build-data-only
Open

cjm-dd wants to merge 1 commit into
bazel-contrib:mainfrom
cjm-dd:stamp-transition-build-data-only

Conversation

@cjm-dd

@cjm-dd cjm-dd commented Nov 12, 2026 •

Copy link
Copy Markdown

The stamp attribute of py_binary and py_test transitions the --stamp flag for the whole target. py_test defaults to stamp = 0, so under --stamp every test builds its entire dependency tree in a second configuration, apart from the binaries that share those dependencies.

The transition exists so that the _uncachable_version_file dependency is conditional on stamping. Move it onto that attribute edge. The edge sets --stamp only for stamp = 1. With stamp = 0 the file is never read, and stamp = -1 follows the flag, so neither changes the configuration. is_stamping_enabled() already reads the attribute directly, so the build data contents are unchanged.

The `stamp` attribute of `py_binary` and `py_test` transitions the `--stamp`
flag for the whole target. `py_test` defaults to `stamp = 0`, so under
`--stamp` every test builds its entire dependency tree in a second
configuration, apart from the binaries that share those dependencies.

The transition exists so that the `_uncachable_version_file` dependency is
conditional on stamping. Move it onto that attribute edge. The edge sets
`--stamp` only for `stamp = 1`. With `stamp = 0` the file is never read, and
`stamp = -1` follows the flag, so neither changes the configuration.
`is_stamping_enabled()` already reads the attribute directly, so the build
data contents are unchanged.

In a downstream repo that builds with `--stamp`, analyzing one `py_binary`
and its `py_test` dropped from 633 to 448 configured targets.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@cjm-dd

cjm-dd commented Nov 12, 2026

Copy link
Copy Markdown
Author

This PR was prepared with Claude Code, an AI coding agent, on behalf of the author. Claude Code may draft replies to review comments and follow-up commits. The author reviews and approves each one before it is posted or pushed.

Agent-generated comment (Claude Code, Claude Opus 5.5), reviewed and approved by the author.

@rickeylev rickeylev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh, good find. Thanks!

@rickeylev
rickeylev enabled auto-merge November 12, 2026 17:49
@rickeylev
rickeylev added this pull request to the merge queue Nov 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 12, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants